

def cookie_string_to_dict(cookie_string: str) -> dict:
    cookie_dict = {}
    cookie_list = cookie_string.split(';')
    for cookie in cookie_list:
        cookie = cookie.strip()
        if '=' in cookie:
            key, value = cookie.split('=', 1)
            cookie_dict[key] = value
    return cookie_dict

def cookie_dict_to_string(cookie_dict: dict) -> str:
    cookie_string = ''
    for key, value in cookie_dict.items():
        cookie_string += f'{key}={value}; '
    return cookie_string

